﻿using Abp.Domain.Entities.Auditing;
using FwProject.Core.Restaurant;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace FwProject.PrePaymentInfo
{
    [Table("ReceiptInfo")]
   public  class ReceiptInfoModel : FullAuditedEntity<Guid>
    {
        /// <summary>
        /// 所属工厂
        /// </summary>
        [Display(Name = "所属工厂")]
        public Guid FactoryinfoId { get; set; }

        /// <summary>
        /// 收款单号
        /// </summary>
        public string ReceiptInfoNumber { get; set; }
        /// <summary>
        /// 收款经办人
        /// </summary>
        public string AgentPeoper { get; set; }
        /// <summary>
        /// 收款经办人id
        /// </summary>
        public long AgentPeoperUserId { get; set; }

        /// <summary>
        /// 收款时间
        /// </summary>
        public DateTime? Dateofreceipt { get; set; }

        /// <summary>
        /// 缴款编号
        /// </summary>
        public Guid? PaymentinfoId { get; set; }

        /// <summary>
        /// 缴款经办人
        /// </summary>
        public string PaymentPerson { get; set; }
        /// <summary>
        /// 缴款经办人id
        /// </summary>
        public long? PaymentPersonUserId { get; set; }
        /// <summary>
        /// 缴款时间
        /// </summary>
        public DateTime? DateofPayment { get; set; }

        public Guid RestaurantId { get; set; }
        [ForeignKey("RestaurantId")]

        public virtual RestaurantInfo RestaurantInfoModel { get; set; }

        /// <summary>
        /// 账户编号
        /// </summary>
        public Guid CapitalAccountId { get; set; }

        /// <summary>
        /// 整单金额 此金额是后台制单后的应收金额SettlementInfo Actualprice 字段
        /// </summary>
        public decimal WholeAmount { get; set; }
        /// <summary>
        /// 应收回金额(WholeAmount-PreferentialAmount)
        /// </summary>
        public decimal ActualAmount { get; set; }
        /// <summary>
        /// 使用预收款
        /// </summary>
        public decimal UsePrePayment { get; set; }
        /// <summary>
        /// 实际收回金额
        /// </summary>
        public decimal TaskBackAmount { get; set; }
        /// <summary>
        /// 预收款剩余金额
        /// </summary>
        public decimal UsePrePaymentSurplus { get; set; }
        /// <summary>
        /// 优惠金额
        /// </summary>
        public decimal PreferentialAmount { get; set; }
        /// <summary>
        /// 收款状态 0 未审核1已审核
        /// </summary>
        public ReceiptInfoStatus ReceiptInfoStatus { get; set; } = ReceiptInfoStatus.未提交;
        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime? AudtiTime { get; set; }
        /// <summary>
        /// 缴款状态 0 未缴款 1已缴款
        /// </summary>
        public PaymentState PaymentState { get; set; } = PaymentState.未缴款;

        /// <summary>
        /// 交款时间
        /// </summary>
        public DateTime? PaymentTime { get; set; }

        /// <summary>
        /// 作废状态 0未作废1作废
        /// </summary>
        public ToVoidStatus ToVoid { get; set; } = ToVoidStatus.未作废;

        /// <summary>
        /// 备注
        /// </summary>
        public string RemarksConten { get; set; }

    }
    //收款作废
    public enum ToVoidStatus
    {
        未作废 = 0,
        已作废 = 1
    }
    //收款作废
    public enum PaymentState
    {
        未缴款 = 0,
        已缴款 = 1

    }
    public enum ReceiptInfoStatus
    {
        未提交 = 0,
        已提交 = 1,
        已审核 = 2,
        退回 = 3
    }
}
